/** @jsxImportSource @emotion/react */
import * as React from "react";
import {CCell, Table, TableBody, TableRow,} from "customize-easy-ui-component";
import {CCellUnit, RepLink, } from "../../common/base";
import {useThreeColumnView} from "../../hook/useThreeColumnSubr";
import {input日期} from "../../common/render";

const 载体类选=['液相有机热载体','气相有机热载体'];
const 样位置选=['油桶',];
const 厂检选=['符合','不符合'];
//有机热载体情况
export const config热载体况 = [
  [['有机热载体种类', {n: '载体类别', t: 'l', l: 载体类选}], ],
  [['生产单位', '载生产单'], ['产品牌号', '载牌号'] ],
  [['产品标记', '载品标记'], ['最高工作温度', {n: '高工温', u:'℃'}], ['出厂检验报告', {n: '出厂检', t: 'l', l: 厂检选}] ],
  [['制造日期', '载制造日'], ['取样位置', {n: '取样位', t: 'l', l: 样位置选}], ],
];

export const CarrierConditionVw = ({orc, rep}: { orc: any, rep: any }
) => {
  const [_1,secondP,_2]=useThreeColumnView({orc, config:config热载体况,slash:true, split:[1,3] });
  return <>
    <Table id={'CarrierCondition'} fixed={ ["5%","8.1%","30%","17.1%","12%","12.1%","%"] }
                  css={{borderCollapse: 'collapse', }} tight  miniw={800}>
      <TableBody>
        <RepLink rep={rep} tag={"CarrierCondition"}>
          <TableRow>
            <CCell rowSpan={4}>有机热载体情况</CCell>
            <CCell colSpan={2}>有机热载体种类</CCell><CCell colSpan={4}>{orc?.载体类别 || '／'}</CCell>
          </TableRow>
          {secondP}
          <TableRow>
            <CCell>制造日期</CCell><CCell>{orc?.载制造日 || '／'}</CCell>
            <CCell>取样位置</CCell><CCell colSpan={3}>{orc?.取样位 || '／'}</CCell>
          </TableRow>
        </RepLink>
      </TableBody>
    </Table>
  </>;
};

const 许用系选=['可用于开式系统和闭式系统','仅适用于闭式系统'];
export const config型式试 = [
  [['型式试验机构',{n: '型验机构', t: 'B'}],  ['型式试验报告编号', '型试报号'] ],
  [['试验日期','型试日',input日期('型试日','试验日期')], ['最高允许使用温度', {n: '允用温', u:'℃'}], ['初馏点',{n: '初馏点', u:'℃'}] ],
  [['允许使用系统', {n: '许用系', t: 'l', l: 许用系选}], ['2%馏程温度',{n: '馏程温', u:'℃'}]  ],
];

export const TypeTestVw = ({orc, rep}: { orc: any, rep: any }
) => {
  //const render=useThreeColumnView({orc, config:config型式试,slash:true, embedCol: [<CCell rowSpan={4}>型式试验情况</CCell>] });
  return <>
    <Table id={'TypeTest'} fixed={ ["5%","8.1%","4%","%","16.1%","10%","11%","19%"]  }
                  css={{borderCollapse: 'collapse', }} tight  miniw={800}>
      <TableBody>
        <RepLink rep={rep} tag={"TypeTest"}>
          <TableRow>
            <CCell rowSpan={3}>型式试验情况</CCell>
            <CCell colSpan={2}>型式试验机构</CCell><CCell colSpan={2}>{orc?.型验机构 || '／'}</CCell>
            <CCell colSpan={2}>型式试验报告编号</CCell><CCell>{orc?.型试报号 || '／'}</CCell>
          </TableRow>
          <TableRow>
            <CCell>试验日期</CCell><CCell colSpan={2}>{orc?.型试日 || '／'}</CCell>
            <CCell>最高允许使用温度</CCell><CCellUnit unit={'℃'}>{orc?.允用温 || '／'}</CCellUnit>
            <CCell>初馏点</CCell><CCellUnit unit={'℃'}>{orc?.初馏点 || '／'}</CCellUnit>
          </TableRow>
          <TableRow>
            <CCell colSpan={2}>允许使用系统</CCell><CCell  colSpan={3}>{orc?.许用系 || '／'}</CCell>
            <CCell>2%馏程温度</CCell><CCellUnit unit={'℃'}>{orc?.馏程温 || '／'}</CCellUnit>
          </TableRow>
        </RepLink>
      </TableBody>
    </Table>
  </>;
};
